package org.java.desgin.patterns.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class ProxyInvocationHandler implements InvocationHandler {
	
	private Object obj;
	
	public ProxyInvocationHandler(Object obj){
		this.obj=obj;
	}

	@Override
	public Object invoke(Object proxy, Method method, Object[] args)
			throws Throwable {
		before();
		Object rtObj=method.invoke(obj, args);
		after();
		return rtObj;
	}
	
	public void before(){
		System.out.println("before invoke");
	}
	
	public void after(){
		System.out.println("after invoke");
	}

	
}
